package org.example.j2024_11_10;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/calc")
@RestController
public class CalcController {
    @RequestMapping("/sum")
    public String sum(Integer num1 , Integer num2){
        String response = "计算结果 : ";
        if(num1==null&&num2==null)return response+ 0;
        if(num1==null) return response+num2 ;
        if(num2==null) return response+num1 ;
        return response+ (num1+num2) ;
    }

}
